﻿<navigation:PageView x:Class="Corina.Cydee.Apphub.Views.Home"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:localViewmodel="clr-namespace:Corina.Cydee.Apphub.Viewmodels"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:navigation="clr-namespace:Corina.Cydee.Apphub.Base"
                     Title="首页"
                     FontSize="14"
                     d:DesignHeight="480"
                     d:DesignWidth="640"
                     mc:Ignorable="d">
    <navigation:PageView.DataContext>
        <localViewmodel:HomeViewmodel />
    </navigation:PageView.DataContext>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid Margin="0,12"
              VerticalAlignment="Center"
              Visibility="{Binding ShowUnresolved,
                                   Converter={StaticResource BooleanToVisibilityConverter}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Grid>
                <Grid Name="backgroundGrid"
                      Width="72"
                      Height="72"
                      Visibility="Visible">
                    <Rectangle Name="Rect"
                               Fill="OrangeRed"
                               Visibility="Visible" />
                </Grid>
                <Path Width="48"
                      Height="48"
                      Margin="0,0,0,0"
                      Data="M32.618801,28.967218C33.978199,28.967218,34.6604,29.808237,34.6604,31.491722L30.332298,31.491722C30.426098,30.772436 30.683899,30.172224 31.108398,29.689653 31.5329,29.207323 32.038097,28.967218 32.618801,28.967218z M38.841,26.809L42.158691,38.560997 45.92157,38.560997 47.780807,31.629671C47.882404,31.254751,47.957901,30.76907,48.0126,30.172174L48.080295,30.172174C48.093296,30.715023,48.160995,31.215694,48.275593,31.674587L50.009937,38.560997 53.817112,38.560997 57.204998,26.809 53.843109,26.809 52.317161,34.475235C52.231262,34.919807,52.168762,35.362484,52.129669,35.807156L52.048969,35.807156C51.989071,35.111198,51.934372,34.666725,51.890076,34.475235L50.077633,26.809 46.622047,26.809 44.603912,34.430336C44.502315,34.796215,44.434616,35.24799,44.395519,35.783657L44.32782,35.783657C44.288822,35.271389,44.231522,34.835213,44.155926,34.475235L42.536179,26.809z M32.639599,26.521999C30.986,26.521999 29.595398,27.092243 28.462498,28.232164 27.329698,29.372774 26.761999,30.918148 26.761999,32.868568 26.761999,34.751251 27.288099,36.218662 28.334898,37.269398 29.384399,38.322132 30.858398,38.848 32.7542,38.848 34.491199,38.848 35.905201,38.557716 36.991199,37.976353L36.991199,35.359314C36.009399,35.971977 34.874,36.277359 33.582298,36.277359 31.553699,36.277359 30.478199,35.42371 30.358398,33.718117L38.025001,33.718117 38.025001,32.191509C38.024998,30.446867 37.556301,29.066122 36.618801,28.049246 35.681301,27.031057 34.353199,26.521999 32.639599,26.521999z M9.2519998,22.103001L9.2519998,38.560997 12.752072,38.560997 12.752072,29.517489C12.752072,28.323488,12.72082,27.435539,12.660911,26.854862L12.705201,26.854862C12.858844,27.161375,13.134889,27.616594,13.530726,28.22068L20.314724,38.560997 24.057001,38.560997 24.057001,22.103001 20.556929,22.103001 20.556929,31.204367C20.556929,32.328651,20.585529,33.083233,20.648031,33.465424L20.60383,33.465424C20.348524,33.022533,20.072519,32.574043,19.775614,32.122356L13.246861,22.103001z M39.468643,0.00014651669C40.098942,-0.0074597701,40.717853,0.28131244,41.11887,0.81434045L45.376652,6.487413 52.462631,6.7672887C53.428726,6.8051582,54.236023,7.5193172,54.387024,8.4724923L55.519817,15.474246 61.668301,19.015892C62.501594,19.498283,62.884392,20.504169,62.574497,21.420755L60.324505,28.146553 64.123993,34.13736C64.642181,34.952446,64.509384,36.022228,63.811493,36.691422L58.694309,41.598946 59.269909,48.667736C59.348007,49.632023,58.736008,50.51611,57.80891,50.784206L50.996433,52.749874 48.217846,59.277077C47.842846,60.167561,46.884449,60.676052,45.941753,60.472855L38.993877,59.049881 33.504295,63.539909C33.134495,63.8452 32.673599,63.999001 32.220501,63.999001 31.7621,63.999001 31.306402,63.8452 30.931404,63.539909L25.441824,59.049881 18.493946,60.472855C17.55125,60.677952,16.592955,60.165661,16.217955,59.277077L13.444465,52.749874 6.632019,50.784206C5.6997217,50.51611,5.0877542,49.632023,5.1658835,48.667736L5.7413916,41.598946 0.62422565,36.691422C-0.073694263,36.022228,-0.20128782,34.952446,0.3169297,34.13736L4.1111979,28.146553 1.8612045,21.420755C1.551296,20.504169,1.9341148,19.498283,2.7726521,19.015892L8.9158706,15.474246 10.048676,8.4724923C10.199676,7.5193172,11.006973,6.8051582,11.97317,6.7672887L19.059046,6.487413 23.316832,0.81434045C23.90023,0.041560051,24.944425,-0.21756085,25.814222,0.19911957L32.220501,3.2452133 38.621475,0.19911957C38.893288,0.068296638,39.18214,0.0036039796,39.468643,0.00014651669z"
                      Fill="#FFFFFFFF"
                      RenderTransformOrigin="0.5,0.5"
                      Stretch="Uniform">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <TransformGroup.Children>
                                <RotateTransform Angle="0" />
                                <ScaleTransform ScaleX="1" ScaleY="1" />
                            </TransformGroup.Children>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Grid>

            <StackPanel Grid.Column="1" Margin="12,0">
                <TextBlock FontSize="{StaticResource HeaderFontSize}">
                    <Run Text="当前有 " />
                    <Run Text="{Binding UnresolvedCount}" />
                    <Run Text=" 未处理数据" />
                </TextBlock>
                <TextBlock Text="{Binding MessageContent}" />
            </StackPanel>

            <Button Grid.Column="2"
                    Width="100"
                    VerticalAlignment="Center"
                    Command="{Binding GotoResolveCommand}"
                    Content="前去处理" />
        </Grid>

        <Grid Grid.Row="1" VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid Visibility="{Binding ShowSettingsPanel, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <StackPanel Margin="0,0,24,0">
                    <CheckBox Content="在首页显示未处理消息"
                              IsChecked="{Binding ShowUnresolvedOnHome,
                                                  Mode=TwoWay}"
                              Style="{StaticResource SwitcherStyle}" />
                    <CheckBox Margin="0,12"
                              Command="{Binding InstallOOBCommand}"
                              Content="在浏览器外运行"
                              IsChecked="{Binding IsRunningOutOfBrowser}"
                              Style="{StaticResource SwitcherStyle}" />
                    <Button Command="{Binding ChechUpdateCommand}"
                            Content="检查更新"
                            Visibility="{Binding IsRunningOutOfBrowser,
                                                 Converter={StaticResource BooleanToVisibilityConverter}}" />

                </StackPanel>
                <StackPanel Grid.Column="1" Margin="24,0,0,0">
                    <TextBlock Text="{Binding CurrentOS}" />
                    <TextBlock Margin="0,12">
                        <Run Text="上次登录：" />
                    </TextBlock>
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Rectangle Height="1" Fill="Gray" />
                <Rectangle Grid.Column="2"
                           Height="1"
                           Fill="Gray" />
                <CheckBox Grid.Column="1"
                          Margin="3"
                          IsChecked="{Binding ShowSettingsPanel,
                                              Mode=TwoWay}">
                    <CheckBox.Style>
                        <Style TargetType="CheckBox">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="CheckBox">
                                        <Grid Width="24" Height="24">
                                            <Ellipse Fill="#FF000000"
                                                     Opacity="0"
                                                     Visibility="Visible" />
                                            <Ellipse Stroke="Gray"
                                                     StrokeThickness="1"
                                                     Visibility="Visible" />
                                            <Path Width="12"
                                                  Height="12"
                                                  Margin="0,0,0,0"
                                                  Data="F1M181.297,177.841L181.205,177.746 181.385,177.563 202.804,156.146 202.804,135.07 178.497,159.373 170.847,167.026 170.666,167.205 163.107,159.653 138.804,135.345 138.804,156.42 160.219,177.841 170.76,188.379 181.297,177.841z"
                                                  Fill="Gray"
                                                  RenderTransformOrigin="0.5,0.5"
                                                  Stretch="Uniform"
                                                  Visibility="{Binding IsChecked,
                                                                       Converter={StaticResource BooleanToVisibilityInverseConverter},
                                                                       RelativeSource={RelativeSource TemplatedParent}}">
                                                <Path.RenderTransform>
                                                    <TransformGroup>
                                                        <TransformGroup.Children>
                                                            <RotateTransform Angle="0" />
                                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                                        </TransformGroup.Children>
                                                    </TransformGroup>
                                                </Path.RenderTransform>
                                            </Path>
                                            <Path Width="12"
                                                  Height="12"
                                                  Margin="0,0,0,0"
                                                  Data="F1M753.644,-13.0589L753.736,-12.9639 753.557,-12.7816 732.137,8.63641 732.137,29.7119 756.445,5.40851 764.094,-2.24384 764.275,-2.42352 771.834,5.1286 796.137,29.4372 796.137,8.36163 774.722,-13.0589 764.181,-23.5967 753.644,-13.0589z"
                                                  Fill="Gray"
                                                  RenderTransformOrigin="0.5,0.5"
                                                  Stretch="Uniform"
                                                  Visibility="{Binding IsChecked,
                                                                       Converter={StaticResource BooleanToVisibilityConverter},
                                                                       RelativeSource={RelativeSource TemplatedParent}}">
                                                <Path.RenderTransform>
                                                    <TransformGroup>
                                                        <TransformGroup.Children>
                                                            <RotateTransform Angle="0" />
                                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                                        </TransformGroup.Children>
                                                    </TransformGroup>
                                                </Path.RenderTransform>
                                            </Path>
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </CheckBox.Style>
                </CheckBox>
            </Grid>
        </Grid>

    </Grid>
</navigation:PageView>
